<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('【请填写功能名称】列表')" />
</head>
<body class="gray-bg">
     <div class="container-div" id="bcyyorder">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                         <!--   <li>
                                <label>线路ID：</label>
                                <input type="text" name="lineid"/>
                            </li>
                            <li>
                                <label>班次ID：</label>
                                <input type="text" name="banciid"/>
                            </li>
                            <li>
                                <label>站点ID：</label>
                                <input type="text" name="zhandianid"/>
                            </li>-->
                            <li style="display: none" >
                                <label>线路：</label>
                                <input id="lineid" name="lineid" class="form-control" v-model="lineid">
                            </li>
                            <!--<li>
                                <label>预约时间：</label>
                                <input type="text" class="time-input" placeholder="请选择预约时间" name="yuyueshijian"/>
                            </li>-->
                            <li>
                                <label>班车时间：</label>
                                <input id="bancheshijian" type="text" class="time-input" placeholder="请选择班车时间" name="bancheshijian"/>
                            </li>
                            <li style="display: inline">
                                <label>时段：</label>
                                <select id="shiduan" name="shiduan" class="form-control">
                                    <option value="" >请选择</option>
                                    <option value="0" >早上</option>
                                    <option value="1" >中午</option>
                                    <option value="2" >下午</option>
                                </select>
                            </li>
                            <div style="float: left">
                            <a  style="height: 100px;width: 150px;" class="btn btn-success" onclick="chaxun('001')" >
                                <i class="fa fa-group"></i> 一号线<div style="padding-top:5px;font-size:xx-large" id="xianlu1">  </div>
                            </a>
                            <a style="height: 100px;width: 150px;" class="btn btn-primary" onclick="chaxun('002')" >
                                <i class="fa fa-group"></i> 二号线<div style="padding-top:5px;font-size:xx-large" id="xianlu2">  </div>
                            </a>
                            <a style="height: 100px;width: 150px;" class="btn btn-info" onclick="chaxun('003')" >
                                <i class="fa fa-group"></i> 三号线<div  style="padding-top:5px;font-size:xx-large" id="xianlu3">  </div>
                            </a>
                            <a style="height: 100px;width: 150px;" class="btn btn-success" onclick="chaxun('004')" >
                                <i class="fa fa-group"></i> 四号线<div style="padding-top:5px;font-size:xx-large"  id="xianlu4">  </div>
                            </a>
                            <a style="height: 100px;width: 150px;" class="btn btn-warning" onclick="chaxun('005')" >
                                <i class="fa fa-group"></i> 马群东苑线<div style="padding-top:5px;font-size:xx-large" id="xianlu5">  </div>
                            </a>
                            <a style="height: 100px;width: 150px;" class="btn btn-danger" onclick="chaxun('006')" >
                                <i class="fa fa-group"></i> 新门口线<div style="padding-top:5px;font-size:xx-large"  id="xianlu6">  </div>
                            </a>
                            <a style="height: 100px;width: 150px;" class="btn btn-success" onclick="chaxun('007')" >
                                <i class="fa fa-group"></i> 紫金墨香苑线<div style="padding-top:5px;font-size:xx-large" id="xianlu7">  </div>
                            </a>
                            </div>
                            <div style="clear:both"></div>
                          <!--  <li>
                                <label>状态：</label>
                                <select name="status">
                                    <option value="">所有</option>
                                    <option value="-1">代码生成请选择字典属性</option>
                                </select>
                            </li>-->
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="change()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
            <!--    <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:order:add">
                    <i class="fa fa-plus"></i> 添加
                </a>
                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="system:order:edit">
                    <i class="fa fa-edit"></i> 修改
                </a>
                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:order:remove">
                    <i class="fa fa-remove"></i> 删除
                </a>
                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:order:export">
                    <i class="fa fa-download"></i> 导出
                </a>-->

            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:src="@{/index/common/vue.js}"></script>
    <script th:inline="javascript">
        var prefix = ctx + "system/order";

        var d = new Date();
        var time = d.getFullYear() + '-' + (d.getMonth() + 1) + '-' + (d.getDate()+ 1);
        $('#bancheshijian').val(time);

        function InitSelect(){
            $.ajax({
                type: "post",
                url:  "/system/line/customlist",
                data: {
                },
                success: function(r) {
                    $("#lineid").empty();
                    $("#lineid").append("<option value=''>请选择线路</option>");
                    for (var i = 0; i < r.length; i++) {
                        $("#lineid").append("<option value='" + r[i].lineid + "'>" + r[i].name + "</option>");
                    }
                }
            });
        }

        function chaxun(ppvalue){

            $("#lineid").val(ppvalue);
            $.table.search();
            $.ajax({
                type: "post",
                url:  prefix+"/chaxunlist",
                data: {
                    'lineid':ppvalue,
                    'bancheshijian':$('#bancheshijian').val(),
                    'shiduan' :$("select[name='shiduan']").val(),
                },
                success: function(r) {
                    if (r.code == 0) {
                        var shuliang=r.total;
                        if(ppvalue=='001'){
                            $("#xianlu1").text(shuliang+"人");
                        }
                        if(ppvalue=='002'){
                            $("#xianlu2").text(shuliang+"人");
                        }
                        if(ppvalue=='003'){
                            $("#xianlu3").text(shuliang+"人");
                        }
                        if(ppvalue=='004'){
                            $("#xianlu4").text(shuliang+"人");
                        }
                        if(ppvalue=='005'){
                            $("#xianlu5").text(shuliang+"人");
                        }
                        if(ppvalue=='006'){
                            $("#xianlu6").text(shuliang+"人");
                        }
                        if(ppvalue=='007'){
                            $("#xianlu7").text(shuliang+"人");
                        }
                    } else {
                        alert(r.msg);
                    }
                }
            });
        }

        function change(){
            chaxun("002");
            chaxun("003");
            chaxun("004");
            chaxun("005");
            chaxun("006");
            chaxun("007");
            chaxun("001");
        }

        $(function() {
            InitSelect();

            chaxun("002");
            chaxun("003");
            chaxun("004");
            chaxun("005");
            chaxun("006");
            chaxun("007");
            chaxun("001");

            var options = {
                url: prefix + "/chaxunlist",
                modalName: "【班车预约】",
                columns: [{
                    checkbox: true
                },
                {
                    field: 'shiduan',
                    visible: false
                },
                {
                    field: 'orderid',
                    title: '预约ID',
                    visible: false
                },
                {
                    field: 'lineid',
                    title: '线路ID',
                    visible: false
                },
                {
                    field: 'banciid',
                    title: '班次ID',
                    visible: false
                },
                {
                    field: 'zhandianid',
                    title: '站点ID',
                    visible: false
                },
                {
                    field: 'linename',
                    title: '线路'
                },
                {
                    field: 'zhandianname',
                    title: '上车点'
                },
                {
                    field: 'yuyuerenname',
                    title: '预约人'
                },
/*                    {
                        field: 'text1',
                        title: '科室'
                    },*/
                {
                    field: 'shoujihao',
                    title: '手机号'
                },
                {
                    field: 'yuyueshijian',
                    title: '预约时间'
                },
                {
                    field: 'bancheshijian',
                    title: '班车时间'
                },

                    /* {
                         field: 'status',
                         title: '状态'
                     },
                         {
                             field: 'text1',
                             title: '状态'
                         },
                         {
                             field: 'text2',
                             title: '状态'
                         },
                         {
                             field: 'text3',
                             title: '状态'
                         },
                         {
                             field: 'text4',
                             title: '状态'
                         },
                         {
                             field: 'text5',
                             title: '状态'
                         },*/
               /* {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.orderid + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.orderid + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }*/]
            };
            $.table.init(options);
        });
    </script>
</body>
</html>